import 'dart:io';

import 'package:example/components/test_widget.dart';
import 'package:example/video_editor/video_editor_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:zz_video_maker/zz_video_maker.dart';

import 'other/vertical_scroll_component.dart';

class TestPage extends StatefulWidget {
  const TestPage({super.key});

  @override
  State<TestPage> createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: SafeArea(
          child: Stack(
        fit: StackFit.expand,
        children: [
          Column(
            children: [
              Center(
                child: TextButton(
                    onPressed: () {
                      Get.to(const VideoEditorPage(
                        isAsset: true,
                        path: "assets/phase2-exported-set0.json",
                      ));
                    },
                    child: const Text('AssetJson')),
              ),
              Center(
                child: TextButton(
                    onPressed: () {
                      var filePath = '$appDirectoryPath/last.json';
                      var isExits = File(filePath).existsSync();
                      if (!isExits) {
                        showDialog(
                          context: context,
                          builder: (context) {
                            return const AlertDialog(
                              title: Text('本地不存在'),
                            );
                          },
                        );
                        return;
                      }
                      Get.to(VideoEditorPage(
                        isAsset: false,
                        path: filePath,
                      ));
                    },
                    child: const Text('LastJson')),
              ),
            ],
          ),
          // Container(color: Colors.red, child: ZoomableAndDraggableComponent()),
          // VerticalScrollComponent()
        ],
      )),
    );
  }
}
